package com.itheima.youdianda.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.youdianda.entity.YddArticle;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author author
 * @since 2022-05-24
 */
@Mapper
public interface YddArticleMapper extends BaseMapper<YddArticle> {
	/**
	 * 获取上一条数据
	 * @param id
	 * @return
	 */
	@Select("select * from ydd.ydd_article WHERE #{id}>id ORDER BY id DESC limit 1")
	public YddArticle getPrev(String id);

	/**
	 * 获取下一条数据
	 * @param id
	 * @return
	 */
	@Select("select * from ydd.ydd_article WHERE id>#{id} ORDER BY id limit 1")
	public YddArticle getNext(String id);
}
